{% set pypi_name = 'microversion_parse' %}
{% set upstream_version = upstream_version('1.0.1') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack microversion header parser
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://www.openstack.org/
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('WebOb') }}
BuildRequires:  {{ py3('gabbi') }}
BuildRequires:  {{ py3('setuptools') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
A simple parser for OpenStack microversion headers.

%package -n {{ py2name(py_versions='py3') }}
Summary:        OpenStack microversion header parser

%description -n {{ py2name(py_versions='py3') }}
A simple parser for OpenStack microversion headers.

%package -n {{ py2name() }}-doc
Summary:        Documentation for OpenStack Microversion headers
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n {{ py2name() }}-doc
This package contains thedocumentation for OpenStack microversion
headers parsing library.

%prep
%autosetup -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%py3_build

# generate html docs
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%py3_install

%check
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc ChangeLog README.rst
%{python3_sitelib}/microversion_parse
%{python3_sitelib}/microversion_parse*egg-info

%files -n {{ py2name() }}-doc
%license LICENSE
%doc doc/build/html

%changelog
